package com.zzyl.task;

import com.zzyl.mapper.CustomerReservationMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @Description MyTask
 * @Author chenchuang
 * @Date 2024-08-31
 */
@Component
@Slf4j
public class MyTask {

    @Autowired
    private CustomerReservationMapper customerReservationMapper;

    @Scheduled(cron = "0 1/31 0-23 * * ?")
    public void executeTask(){
        log.info("定时任务开始执行：{}", LocalDateTime.now());
        customerReservationMapper.updateStatusByTime(LocalDateTime.now());
    }
}
